#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2022, Andrey Kunitsyn
#
# This file is part of the modm project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------

def init(module):
    module.name = ":platform:dma"
    module.description = "Direct Memory Access (DMA)"


def prepare(module, options):
    module.depends(":cmsis:device", ":platform:clockgen")
    return options[":target"].has_driver("dma:rp20*")


def build(env):
    env.substitutions = {"dma": env[":target"].get_driver("dma")}
    env.outbasepath = "modm/src/modm/platform/dma"
    env.template("dma.hpp.in")

